<?php

session_start();
include 'objects/User.inc';

if (isset($_SESSION['user'])) {
    $user = unserialize($_SESSION['user']);
} else {
    $user = new User();
}

if (isset($_GET["logout"])) {
    session_unset();
}

if (!$user->isLogged()) {
    header("Location: main.php");
} else {
    header("Location: index.php");
}
?>
